import request from '/@/utils/request';

/**
 * 后端控制路由，isRequestRoutes 为 true，则开启后端控制路由
 */
export function systemApi() {
	return {
		/**
		 * -------------------- 用户管理--------------------------
		 */
		// 获取用户列表
		getUserList: (params?: object) => {
			return request({
				url: '/system/getUserList',
				method: 'get',
				params,
			});
		},
		// 添加or编辑用户
		addUser: (params?: object) => {
			return request({
				url: '/system/saveUser',
				method: 'post',
				data: params,
			});
		},
		// 删除用户
		delUser: (params?: object) => {
			return request({
				url: '/system/delUser',
				method: 'post',
				data: params,
			});
		},

		/**
		 * ---------------------角色管理------------------------
		 */
		// 获取角色列表
		getRoleList: (params?: object) => {
			return request({
				url: '/system/getRoleList',
				method: 'get',
				params,
			});
		},
		// 获取角色列表(不分页)
		getRoleListNopage: () => {
			return request({
				url: '/system/getRoleListNopage',
				method: 'get',
			});
		},
		// 获取某个角色对应的菜单
		getMenuRole: (params?: object) => {
			return request({
				url: '/system/getMenuRole',
				method: 'get',
				params,
			});
		},
		// 添加or编辑角色
		addRole: (params?: object) => {
			return request({
				url: '/system/saveRole',
				method: 'post',
				data: params,
			});
		},
		// 删除角色
		delRole: (params?: object) => {
			return request({
				url: '/system/delRole',
				method: 'post',
				data: params,
			});
		},
		// 保存某个角色的菜单权限
		savePermission: (params?: object) => {
			return request({
				url: '/system/savePermission',
				method: 'post',
				data: params,
			});
		},

		/**
		 * ---------------------菜单管理-------------------
		 */
		// 获取菜单列表
		getMenuList: (params?: object) => {
			return request({
				url: '/system/getMenuList',
				method: 'get',
				params,
			});
		},
		// 添加菜单
		addMenu: (params?: object) => {
			return request({
				url: '/system/saveMenu',
				method: 'post',
				data: params,
			});
		},
		// 删除菜单
		delMenu: (params?: object) => {
			return request({
				url: '/system/delMenu',
				method: 'post',
				data: params,
			});
		},

		/**
		 * ---------------------一级代理商---------------------
		 */
		// 获取列表
		getCompanyList: (params?: object) => {
			return request({
				url: '/system/getCompanyList',
				method: 'get',
				params,
			});
		},
		// 添加or编辑
		addCompany: (params?: object) => {
			return request({
				url: '/system/saveCompany',
				method: 'post',
				data: params,
			});
		},
		// 删除
		delCompany: (params?: object) => {
			return request({
				url: '/system/delCompany',
				method: 'post',
				data: params,
			});
		},
		// 获取列表，不分页，查全部
		getCompanyListNopage: (params?: object) => {
			return request({
				url: '/system/getCompanyListNopage',
				method: 'get',
				params,
			});
		},

		/**
		 * ---------------------授权码---------------------
		 */
		// 获取列表
		getCodeList: (params?: object) => {
			return request({
				url: '/system/getCodeList',
				method: 'get',
				params,
			});
		},


		/**
		 * ---------------------电脑主机管理---------------------
		 */
		// 获取列表
		getComputerList: (params?: object) => {
			return request({
				url: '/system/getComputerList',
				method: 'get',
				params,
			});
		},
		// 审核
		examineComputer: (params?: object) => {
			return request({
				url: '/system/examineComputer',
				method: 'post',
				data: params,
			});
		},
		// 延期
		extensionComputer: (params?: object) => {
			return request({
				url: '/system/extensionComputer',
				method: 'post',
				data: params,
			});
		},


		/**
		 * ---------------------账号管理---------------------
		 */
		// 获取列表
		getAccountList: (params?: object) => {
			return request({
				url: '/system/getAccountList',
				method: 'get',
				params,
			});
		},
		// 添加or编辑
		addAccount: (params?: object) => {
			return request({
				url: '/system/saveAccount',
				method: 'post',
				data: params,
			});
		},
		// 删除
		delAccount: (params?: object) => {
			return request({
				url: '/system/delAccount',
				method: 'post',
				data: params,
			});
		},


		/**
		 * ---------------------ip代理管理---------------------
		 */
		// 获取列表
		getIpProxyList: (params?: object) => {
			return request({
				url: '/system/getIpProxyList',
				method: 'get',
				params,
			});
		},
		// 添加or编辑
		addIpProxy: (params?: object) => {
			return request({
				url: '/system/saveIpProxy',
				method: 'post',
				data: params,
			});
		},
		// 删除
		delIpProxy: (params?: object) => {
			return request({
				url: '/system/delIpProxy',
				method: 'post',
				data: params,
			});
		},


		/**
		 * ---------------------任务管理---------------------
		 */
		// 获取列表
		getTaskList: (params?: object) => {
			return request({
				url: '/system/getTaskList',
				method: 'get',
				params,
			});
		},
		// 添加or编辑
		addTask: (params?: object) => {
			return request({
				url: '/system/saveTask',
				method: 'post',
				data: params,
			});
		},
		// 删除
		delTask: (params?: object) => {
			return request({
				url: '/system/delTask',
				method: 'post',
				data: params,
			});
		},


		/**
		 * ---------------------工会管理---------------------
		 */
		// 列表，不分页，查全部
		getLaborunionListNopage: (params?: object) => {
			return request({
				url: '/system/getLaborunionListNopage',
				method: 'get',
				params,
			});
		},


	};
}
